home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lantools / blts892 / indirect.txt < prev    next >
Text File  |  1990-08-02  |  8KB  |  196 lines

  1. Indirect Files
  2.  
  3. Indirect files allow you to have access to a file without explicitly
  4. referencing its directory or changing your PATH statement.  An indirect file
  5. is linked to another file on a network drive.  Any operation on the indirect
  6. file is actually made on the file to which it points.
  7.  
  8. For example, suppose you have a file you reference often, such as a data or
  9. an include file.  We ll use the file ORIGINAL.BAT which resides in the root
  10. directory of the server HOST1 as an example.  The physical path of this file
  11. is as follows:
  12.  
  13. C:\ORIGINAL.BAT
  14.  
  15. The network resource name for the C: drive is C-DRIVE.  The network path of
  16. this file is as follows:
  17.  
  18. \\HOST1\C-DRIVE\ORIGINAL.BAT
  19.  
  20. With this information, you can set up an indirect file in another directory
  21. to point to ORIGINAL.BAT
  22.  
  23. 1.  Make sure the network resource where you will create the indirect file
  24.     has the indirect file (I) access right enabled.  For information on
  25.     setting ACL rights refer to "Shared Resources" in this manual.
  26.  
  27. 2.  Log in to the server and redirect one of your drives to the network
  28.     resource C-DRIVE on HOST1.  You can perform these functions through
  29.     either the NET program or by NET command line.
  30.  
  31. 3.  Change to the directory where you would like to place the indirect file.  In
  32.     this example UTIL:
  33.  
  34.     CD UTIL
  35.  
  36. 4.  Create the indirect file using the syntax:
  37.  
  38.     NET INDIRECT PATHNAME ACTUAL-NAME
  39.  
  40.     where PATHNAME represents the name of the indirect file you would like
  41.     to create and ACTUAL-NAME represents the name of the file to link with
  42.     the indirect file.  We'll name the indirect file INDIRECT.BAT:
  43.  
  44.     NET INDIRECT INDIRECT.BAT  \C-DRIVE\ORIGINAL.BAT
  45.  
  46.     Here we've specified the absolute path to the file INDIRECT.BAT will
  47.     reference.  You can also give the relative path to ORIGINAL.BAT:
  48.  
  49.     NET INDIRECT INDIRECT.BAT  ..\ORIGINAL.BAT
  50.  
  51.     If you use the DIR command for the subdirectory, you will see the indirect
  52.     file INDIRECT.BAT listed with the other files there.
  53.  
  54.      You will notice that the date and month of the indirect file cannot
  55.      possibly exist.  Indirect files will have this date and time to help
  56.      distinguish them from regular DOS files.  The NET DIR command will also
  57.      help distinguish indirect files.  Note that the NET DIR command shows
  58.      the I in the file attributes display as well as the name of the file  to which INDIRECT.BAT points.
  59.  
  60.      You may now access ORIGINAL.BAT from the UTIL subdirectory.  If you
  61.      want to see the contents of ORIGINAL.BAT simply issue a TYPE command
  62.      for INDIRECT.BAT:
  63.  
  64.      Type INDIRECT.BAT
  65.  
  66.      Since INDIRECT.BAT is a batch file, you can execute it by typing:
  67.  
  68.      INDIRECT
  69.  
  70.      The result would be the same as if you had typed:
  71.  
  72.      ..\ORIGINAL
  73.  
  74.      or
  75.  
  76.      C:\ORIGINAL
  77.  
  78.      You can also link other indirect files to INDIRECT.BAT, and have access
  79.      to ORIGINAL.BAT from any other subdirectory.  For example, you could
  80.      link the file IND2.BAT in the APPS subdirectory to INDIRECT.BAT.  To do
  81.      this:
  82.  
  83.      1. Change to the APPS subdirectory.
  84.  
  85.      2. Type the command:
  86.  
  87.      NET INDIRECT IND2.BAT \C-DRIVE\UTIL\INDIRECT.BAT
  88.  
  89.      A directory of the APPS directory would now include the indirect file
  90.      IND2.BAT.  Any requests to IND2.BAT would actually be performed on
  91.      ORIGINAL.BAT.
  92.  
  93.      Note: The DELETE, RENAME and SET ATTRIBUTE functions are always performed
  94.      on the indirect file, not the file to which it points.
  95.  
  96.  
  97. LINKING INDIRECT FILES TO DIRECTORIES
  98.  
  99.      You can also create indirect files to reference directories.  That way
  100.      you can have access to a entire directory of files without having to
  101.      change your PATH statement or specifically reference  that subdirectory.
  102.      This is useful if you have a directory of files you use often.   Follow
  103.      the steps given previously, except this time link the indirect file to a directory.  For example:
  104.  
  105.      NET INDIRECT INDIRECT.DIR  \C-DRIVE\MACROS
  106.  
  107.      If you have the proper ACL rights for the directory MACROS you will be
  108.      able to utilize any of the files within the directory, by referencing
  109.      them through INDIRECT.DIR.  If you wanted to run the file TEST.EXE in
  110.      MACROS you could type:
  111.  
  112.      INDIRECT.DIR\TEST
  113.  
  114.      This would be the same as typing:
  115.  
  116.      C:\MACROS\TEST
  117.  
  118.  
  119. FILE LEVEL SECURITY
  120.  
  121.      One advantage of indirect files is that you can set access to a specific
  122.      file without having to give that type of access to the entire directory.
  123.      For example, if you give L (Look up) access to a network directory PROT
  124.      (Short for PROTected), but want to be able read and write to the file
  125.      ORIGINAL.DOC while in that directory, you can do the following:
  126.  
  127.      Place ORIGINAL.DOC in another network resource such as READWRIT and allow
  128.      read and write access for that resource.
  129.  
  130.      Using the steps described earlier, create an indirect file such as
  131.      INDIRECT.DOC in PROT linked to \READWRIT\ORIGINAL.DOC.
  132.  
  133.      All of the files in the PROT directory would only have L look up access,
  134.      but you would be able to read and write to ORIGINAL.DOC through
  135.      INDIRECT.DOC.
  136.  
  137.      Conversely, you can allow users access to PROT, but if they do not have
  138.      the R and W access to READWRIT, they cannot read or write to ORIGINAL.DOC.
  139.  
  140.      Note:  Some text editors  read data from a file and then write over the
  141.      previous copy when you save the file.  These functions can result in the
  142.      text editor reading the data from the original file, then writing  the
  143.      new version to the indirect file when you save it.  When this occurs,
  144.      you no longer have an indirect file, but simply an updated copy of the
  145.      original file.
  146.  
  147.  
  148. THE NET EXPAND COMMAND
  149.  
  150.      When using indirect files, you can utilize the NET EXPAND to keep track
  151.      of which file will finally be accessed.  This is especially useful if
  152.      you have multiple layers of indirect files.  The NET EXPAND command,
  153.      will also help you find the physical or network path of the indirect
  154.      file.  You can use the NET EXPAND command four ways:  first, you can
  155.      use the command with no switches:
  156.  
  157.      NET EXPAND IND2.BAT
  158.  
  159.      Using the example created earlier, you would see this output:
  160.  
  161.      \\HOST1\C-DRIVE\APPS\IND2.BAT
  162.  
  163.      This output tells you where the file exists relative to the network.
  164.      In this case the file is located on the server HOST1, on the resource
  165.      C-DRIVE in the subdirectory APPS.  If you use the Recurse (/R) switch
  166.      for IND2.BAT:
  167.  
  168.      NET EXPAND/R IND2.BAT
  169.  
  170.      you will see this output:
  171.  
  172.      \\HOST1\C-DRIVE\ORIGINAL.BAT
  173.  
  174.      This switch instructs the NET program to recursively search through all
  175.      the levels of indirect files until it arrives at the final file
  176.      referenced.  Once again, the information given is relative to the files
  177.      location on the redirected drive.  To find the actual physical location
  178.      of IND2.BAT on the server, you would use the Physical (/P) switch:
  179.  
  180.      NET EXPAND/P IND2.BAT
  181.  
  182.      You would see the output:
  183.  
  184.      C:\APPS\IND2.BAT
  185.  
  186.      To find out the physical location of the file to which IND2.BAT finally
  187.      resolves, you would use both the Recurse and Physical switches:
  188.  
  189.      NET EXPAND/P/R IND2.BAT
  190.  
  191.      You will see the output:
  192.  
  193.      C:\ORIGINAL.BAT.
  194.  
  195.      the physical location of the file to which IND2.BAT finally resolves.
  196.